﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WebkitIISHost
{
    public partial class frmWebSiteSetting : Form
    {
        public frmWebSiteSetting()
        {
            InitializeComponent();
        }

        private void frmWebSiteSetting_Load(object sender, EventArgs e)
        {
            txtAppPath.Text = SystemConfig.AppPath;
            nudPort.Value = SystemConfig.AppPort;
            txtVirtRoot.Text = SystemConfig.VirtRoot;
        }

        private void btnSelectFile_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtAppPath.Text =  folderBrowserDialog.SelectedPath;
            }
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            SystemConfig.AppPath = txtAppPath.Text;
            SystemConfig.AppPort = (int) nudPort.Value;
            SystemConfig.VirtRoot = txtVirtRoot.Text;
            SystemConfig.Save();
            DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }
    }
}
